<!DOCTYPE HTML>
<html>
<head>

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>详情</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/css/uploadifive.css">
    <link type="text/css" rel="stylesheet" href="/js/plugins/layer/laydate/skins/default/laydate.css" id="LayDateSkin">


</head>
<body>
<h2>{{if .update}}更新{{else}}添加{{end}}</h2>
<!--style给定宽度可以影响编辑器的最终宽度-->

<!--style给定宽度可以影响编辑器的最终宽度-->
<form id="FORM_validate" action="/goods/{{if .update}}update{{else}}add{{end}}" method="post">
    <input id="form_Id" type="hidden" value="{{if .update}}{{.Goods.Id}}{{end}}" name="{{if .update}}Id{{end}}">
    <div class="">
    	<div class="form-group col-md-12">
            <label class="col-md-3 control-label">标题：</label>
            <div class="col-md-9">
                <input id="form_Title" name="Title" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.Title}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">发布者：</label>
            <div class="col-md-9">
                <input id="form_Author" name="Author" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.Author}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">价格：</label>
            <div class="col-md-9">
                <input id="form_Price" name="Price" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.Price}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">总数：</label>
            <div class="col-md-9">
                <input id="form_TotalCount" name="TotalCount" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.TotalCount}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">库存数：</label>
            <div class="col-md-9">
                <input id="form_RestCount" name="RestCount" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.RestCount}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">编辑时间：</label>
            <div class="col-md-9">
                <input placeholder="YYYY-MM-DD hh:mm:ss" name="edittime"
                       value="{{if .update}}{{date .Goods.EditTime "Y-m-d H:i:s"}}{{end}}"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                       class="laydate-icon form-control layer-date"
                       required="" aria-required="true">
            </div>
        </div>
		<input type="hidden" value="{{if .update}}{{date .Goods.CreateTime "Y-m-d H:i:s"}}{{end}}" name="createtime">
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">简介：</label>
            <div class="col-md-9">
                <input id="form_Introduction" name="Introduction" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.Introduction}}{{end}}">
            </div>
        </div>
        <div class="form-group col-md-12">
            <div class="col-md-3">
                <label class="control-label">列表页图片：</label>
                <input id="form_ListPicPath" type="hidden" name="ListPicPath" value="{{if .update}}{{.Goods.ListPicPath}}{{end}}" required="" aria-required="true">
                <button id="file_upload_ListPicPath" name="file_upload_ListPicPath" type="file" multiple="true"></button>
            </div>
            <div class="col-md-9">
                <img id="form_pic_ListPicPath" src="{{if .update}}{{.Goods.ListPicPath}}{{else}}/img/image.png{{end}}"
                     style="max-height: 380px;width: auto;">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-12 control-label">内容：</label>
            <div class="col-md-12">
                <script type="text/plain" id="myEditor_Content" name="Content" style="width:100%;"></script>
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">文章类型：</label>
            <div class="col-md-9">
                <select class="form-control m-b" name="Type">
                    <option {{if .update}}{{if eq 0 .Goods.Type}}selected="selected"{{end}}{{else}}{{if eq 0 .Type}}selected="selected"{{end}}{{end}} value="0">文化用品</option>
                    <option {{if .update}}{{if eq 1 .Goods.Type}}selected="selected"{{end}}{{else}}{{if eq 1 .Type}}selected="selected"{{end}}{{end}} value="1">图书</option>
                </select>
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">是否可评论：</label>
            <div class="col-md-9">
                <select class="form-control m-b" name="CommentOrNot">
                    <option {{if .update}}{{if eq 0 .Goods.CommentOrNot}}selected="selected"{{end}}{{end}} value="0">不可评论</option>
                    <option {{if .update}}{{if eq 1 .Goods.CommentOrNot}}selected="selected"{{end}}{{end}} value="1">可评论</option>
                </select>
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">是否可购买：</label>
            <div class="col-md-9">
                <select class="form-control m-b" name="BuyOrNot">
                    <option {{if .update}}{{if eq 0 .Goods.BuyOrNot}}selected="selected"{{end}}{{end}} value="0">不可购买</option>
                    <option {{if .update}}{{if eq 1 .Goods.BuyOrNot}}selected="selected"{{end}}{{end}} value="1">可购买</option>
                </select>
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">是否是精品：</label>
            <div class="col-md-9">
                <select class="form-control m-b" name="Recommend">
                    <option {{if .update}}{{if eq 0 .Goods.Recommend}}selected="selected"{{end}}{{end}} value="0">不是精品</option>
                    <option {{if .update}}{{if eq 1 .Goods.Recommend}}selected="selected"{{end}}{{end}} value="1">精品</option>
                    <option {{if .update}}{{if eq 1 .Goods.Recommend}}selected="selected"{{end}}{{end}} value="1">精品置顶</option>
                </select>
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">状态：</label>
            <div class="col-md-9">
                <select class="form-control m-b" name="Status">
                    <option {{if .update}}{{if eq 0 .Goods.Status}}selected="selected"{{end}}{{end}} value="0">未审核</option>
                    <option {{if .update}}{{if eq 1 .Goods.Status}}selected="selected"{{end}}{{end}} value="1">未通过</option>
                    <option {{if .update}}{{if eq 2 .Goods.Status}}selected="selected"{{end}}{{end}} value="2">发布</option>
                </select>
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">点赞：</label>
            <div class="col-md-9">
                <input id="form_StartCount" name="StartCount" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.StartCount}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">浏览人数：</label>
            <div class="col-md-9">
                <input id="form_BrowseCount" name="BrowseCount" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.BrowseCount}}{{end}}">
            </div>
        </div>
		<div class="form-group col-md-12">
            <label class="col-md-3 control-label">浏览人数：</label>
            <div class="col-md-9">
                <input id="form_WatchCount" name="WatchCount" class="form-control" placeholder="请在此输入" value="{{if .update}}{{.Goods.WatchCount}}{{end}}">
            </div>
        </div>
		<input type="hidden" value="{{if .update}}{{.Goods.UserId}}{{end}}" name="UserId">
		<input type="hidden" value="{{if .update}}{{.Goods.CityId}}{{end}}" name="CityId">
		
    	<div class="form-group col-md-12">
            <div class="col-md-12 col-md-offset-3">
                <button class="btn btn-primary" type="submit">保存内容</button>
                {{if .update}}{{else}}
                <button class="btn btn-white" type="submit">取消</button>
                {{end}}
            </div>
        </div>
    </div>
</form>



<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/jquery.uploadifive.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="/js/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/ueditor.all.min.js"></script>
<script type="text/javascript" src="/lang/zh-cn/zh-cn.js"></script>
<script src="/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/js/plugins/validate/messages_zh.min.js"></script>


<!-- jQuery UI -->
<script src="/js/jquery-ui-1.10.4.min.js"></script>
<!-- laydate js -->
<script src="/js/plugins/layer/laydate/laydate.js"></script>

<!--form validate-->
<script>
    $().ready(function () {
        // validate the comment form when it is submitted
        $("#FORM_validate").validate({
            rules: {
                Title:{
                    required:true,
                    minlength: 2
                },
                Author:{
                    required:true,
                    minlength: 2
                },
                Price:{
                    required:true,
                    numbers:true
                },
                TotalCount:{
                    required:true,
                    digits:true
                },
                RestCount:{
                    required:true,
                    digits:true
                },
                Introduction:{
                    required:true,
                    minlength: 2
                },
                StartCount:{
                    required:true,
                    digits:true
                },
                BrowseCount:{
                    required:true,
                    digits:true
                },
                WatchCount:{
                    required:true,
                    digits:true
                },
            }
        });
    });
</script>


<!--实例化编辑器-->
<script type="text/javascript">
    var ue = UE.getEditor('myEditor_Content', {
        autoHeightEnabled: true,
        autoFloatEnabled: true,
        textarea: "Content",
        retainOnlyLabelPasted:true,
        elementPathEnabled:false,
        initialContent:{{.Goods.Content}}
    });
</script>

<!--pic upload-->
<script type="text/javascript">
    $(function () {
            $('#file_upload_ListPicPath').uploadifive({
                'formData': {
                    'Id': $("#form_Id").attr("value"),
                    'imagepath': $("#form_ListPicPath").attr("value")
                },
                'uploadScript': '/goods/picUp',
                'removeCompleted' : true,
                'fileTypeExts': '*.jpg; *.jpeg; *.png',
                'multi': false,
                'onUploadComplete': function (file, data) {
                    var url_new = $.parseJSON(data).Data;
                    $("#form_pic_ListPicPath").attr("src", url_new);
                    $("#form_ListPicPath").attr("value", url_new.substring(0, url_new.indexOf("?time")));
                },
                'onUploadError': function (file, errorCode, errorMsg, errorString) {
                    alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
                }
            });
    });
</script>



</body>
</html>